import xlrd


def read03Excel(path):
    workbook = xlrd.open_workbook(path)
    sheets = workbook.sheet_names()
    worksheet = workbook.sheet_by_name(sheets[0])
    all_items = []
    for i in range(0, worksheet.nrows):
        sub_items = []
        for j in range(0, worksheet.ncols):
            sub_items.append("'{}'".format(worksheet.cell_value(i, j)))
        all_items.append(sub_items)
    return all_items


file = 'description.xls'
data = read03Excel(file)
pre_fix = 'insert into predict.description(col,col_cn,col_abbr) values('
f = open('description.sql', 'w', encoding='utf-8')

for sub in data:
    f.write(pre_fix+','.join(sub)+');\n')
